<extend name="./public/frame.html"/>
<block name="content">
	<blockquote class="layui-elem-quote search">

		<div class="layui-inline">
			<select name="their_id" id="their_id" class="layui-input" lay-filter="province" style="width: 120px;">
				<option value="">车辆所属公司</option>
				<?php foreach($theirList as $key=>$value):?>
				<option value="<?php echo $value['their_id'];?>"><?php echo $value['their_name'];?></option>
				<?php endforeach;?>
			</select>
		</div>

		<div class="layui-inline">
			<input type="text" lay-verify="required|title" required placeholder="请输入手机号" class="layui-input" id="driver_phone" style="width: 120px;">
		</div>

		<br/><br/>
		<div class="layui-inline">
			<button class="layui-btn" data-type="search">搜索</button>

			<button class="layui-btn layui-btn-warm" data-url="{:url('add')}" onclick="add_t(this,'添加司机')">添加司机</button>
		</div>
	</blockquote>
	<table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('Driver/index')}',where:{driver_type:<?php echo $driver_type;?>}, page: true, limit: 10, id:'driver'}" lay-filter="driver">
		<thead>
			<tr>
				<th lay-data="{field:'driver_id', width:70,fixed: true, sort: true,align:'center',fixed: true}">ID</th>
				<th lay-data="{field:'driver_name', width:90,align:'center'}">司机姓名</th>
				<th lay-data="{field:'driver_phone', width:120,align:'center',templet:'#statusTpl'}">手机号码</th>
				<th lay-data="{field:'their_name', width:140,align:'center'}">所属运力</th>
				<th lay-data="{field:'orderNum', width:100,align:'center'}">完成单数
				<th lay-data="{field:'money', width:100,align:'center'}">收入</th>
				<th lay-data="{field:'register_time', width:150,align:'center'}">注册时间</th>
				<th lay-data="{field:'last_login_time', width:150,align:'center'}">登录时间</th>
				<th lay-data="{fixed:'right', toolbar: '#barDemo', width:<?php if($driver_type == 2):?>540<?php else:?>520<?php endif;?>, align:'center'}">操作</th>
			</tr>
		</thead>
	</table>
	<script type="text/html" id="statusTpl">
		{{#if(d.driver_type_status == 1) { }}
		<span style="color: red">{{d.driver_phone}}</span>
		{{# } else { }}
		{{d.driver_phone}}
		{{#}}}
	</script>
	<script type="text/html" id="barDemo">
		<a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>

		<a class="layui-btn layui-btn-xs" lay-event="flow">流水</a>
		<!--<a class="layui-btn layui-btn-xs" lay-event="driver_train">培训</a>-->
		{{#if(d.forbid == 2) { }}
		<a class="layui-btn layui-btn-xs layui-btn-danger " lay-event="forbid">封禁</a>
		{{# } else { }}<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="unforbid">已封</a>
		{{#}}}
        <!--admin_info-->

        <?php if($admin_info['is_css']==2){ ?>
		<a class="layui-btn layui-btn-xs layui-btn-warm " lay-event="distribute">分配</a>
       <?php } ?>
	</script>

	<script type="application/javascript">
		layui.use(['table', 'form', 'laydate'], function () {
			var table = layui.table
				, form = layui.form
				, laydate = layui.laydate;
			lay('.date').each(function(){
				laydate.render({
					elem: this
					,type: 'date'
					,trigger: 'click'
				});
			});
			//监听工具条
			table.on('tool(driver)', function (obj) {
				var data = obj.data;
				var driver_id = data.driver_id;
				var driver_type = data.driver_type;
				if (obj.event === 'detail') {
					layer.open({
						type: 2,
						title: '司机信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/driver/detail","driver_id=")}' + driver_id //iframe的url
					});
				}else if (obj.event === 'supplement') {
					layer.open({
						type: 2,
						title: '司机补录信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/driver/supplement","driver_id=")}' + driver_id //iframe的url
					});
				}else if (obj.event === 'flow') {
					layer.open({
						type: 2,
						title: ['司机流水','color:red;'],
						shadeClose: true,
						shade: 0.8,
						area: ['90%', '90%'],
						content: '/admin/Cash/flow?driver_id=' + driver_id //iframe的url
					});
				}
				else if (obj.event === 'driver_train') {
					layer.open({
						type: 2,
						title: ['培训信息','color:red;'],
						shadeClose: true,
						shade: 0.8,
						area: ['90%', '90%'],
						content: '/admin/System/sjpx?driver_id=' + driver_id //iframe的url
					});
				}else if (obj.event === 'driver_type') {
					layer.confirm('确定降级为快车司机吗?', function (index) {
						var url = "{:U('ajax_driver_type')}";
						var act = 'undriver_type';
						$.post(url, {'driver_id': driver_id,'act': act}, function (data) {
							console.log(data);
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}else if (obj.event === 'undriver_type') {
					layer.confirm('确定升级为城际司机吗?', function (index) {
						var url = "{:U('ajax_driver_type')}";
						$.post(url, {'driver_id': driver_id}, function (data) {
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}else if (obj.event === 'forbid') {
					layer.confirm('确定封禁吗?', function (index) {
						layer.open({
							type: 2,
							title: '司机封禁',
							shadeClose: true,
							shade: 0.8,
							area: ['50%', '60%'],
							content: '{:url("/admin/driver/forbid_info","driver_id=")}' + driver_id //iframe的url
						});
					});
				}
				else if (obj.event === 'unforbid') {
					layer.confirm('确定解除封禁吗?', function (index) {
						var url = "{:U('ajax_forbid')}";
						var act = 'unforbid';
						$.post(url, {'driver_id': driver_id,'act': act}, function (data) {
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}else if (obj.event === 'distribute') { //快车租赁公司分配
					$.ajax({
						url:'{:url("/admin/driver/is_verify")}',
						async:true,
						dataType:'json',
						type:'POST',
						data:{'driver_id':driver_id,'driver_type':driver_type},
						success:function(res){
							if(res.code==1){
								layer.open({
									type: 2,
									title: '司机分配',
									shadeClose: true,
									shade: 0.8,
									area: ['100%', '100%'],
									content: '{:url("/admin/driver/distribute","driver_id=")}' + driver_id + "&driver_type=" + driver_type//iframe的url
								});
							}else{
								layer.msg(res.msg,{icon: 5});
							}
						}
					});
				}else if (obj.event === 'face') {
					layer.confirm('确认人脸识别重置?', function (index) {
						$.ajax({
							url:"{:U('ajax_face')}",
							async:true,
							dataType:'json',
							type:'POST',
							data:{'driver_id':driver_id},
							success:function(res){
								if(res.code==1){
									layer.msg(res.msg,{icon: 6});
								}else{
									layer.msg(res.msg,{icon: 5});
								}
								layer.close(loading);
							}
						});
					});
				}else if (obj.event=='add'){
					layer.open({
						type: 2,
						title: '添加司机信息',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/driver/add")}'
					});
				}else if (obj.event=='edit'){
					layer.open({
						type: 2,
						title: '司机信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/driver/edit","driver_id=")}' + driver_id //iframe的url
					});
				}else if (obj.event === 'down_header') {
					layer.confirm('确定撤销队长职务吗?', function (index) {
						var url = "{:U('ajax_header')}";
						var act = 'down_header';
						$.post(url, {'driver_id': driver_id,'act': act}, function (data) {
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}else if (obj.event === 'up_header') {
					layer.confirm('确定升级为车队队长吗?', function (index) {
						var url = "{:U('ajax_header')}";
						var act = 'up_header';
						$.post(url, {'driver_id': driver_id,'act': act}, function (data) {
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}else if (obj.event === 'qrcode') {
                    layer.open({
                        type: 2,
                        title: '生成二维码',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['310px', '310px'],
                        content: '{:url("/admin/driver/franchisee_code","driverId=")}' + driver_id //iframe的url
                    });

                }
			});
			//搜索
			var $ = layui.jquery, active = {
				search: function () {
					var type 			= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
						start 			= $('#start').val(),									//时间 - 开始
						end 			= $('#end').val(),										//时间 - 结束
						auth_status 	= $('#auth_status').val(),								//认证状态
						compliance_type	=$("#compliance_type").val(),
						driver_phone	= $('#driver_phone').val(),
						referee_type	= $('#referee_type').val(),
						franchisee_info = $('#franchisee_id').val(),
						confor_status	= $("#confor_status").val(),
						work_province	= $("#province_id").val(),
						work_city		= $("#city_id").val(),
						driver_type		= '{$driver_type}',
						refree_phone	= $("#refree_phone").val(),
						all_phone	 	= $("#all_phone").val(),
						driverId	    = $("#driverId").val();//司机driverId
						their_id	    = $("#their_id").val();
					table.reload('driver', {
						url: '/admin/Driver/index', where: {
							"type" : type,
							"start" : start,
							"end" : end,
							"auth_status" : auth_status,
							"compliance_type" : compliance_type,
							"driver_phone" : driver_phone,
							"referee_type" : referee_type,
							"franchisee_info" : franchisee_info,
							"confor_status" : confor_status,
							"all_phone" : all_phone,
							"work_province" : work_province,
							"work_city" : work_city,
							"driver_type" : driver_type,
							"refree_phone" : refree_phone,
							"driverId" : driverId,//司机driverId
							"their_id" : their_id,
						}
					});
				}
				, excel: function () {
					var type 			= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
						start 			= $('#start').val(),									//时间 - 开始
						end 			= $('#end').val(),										//时间 - 结束
						auth_status 	= $('#auth_status').val(),								//认证状态
						compliance_type	= $("#compliance_type").val(),
						driver_phone	= $('#driver_phone').val(),
						referee_type	= $('#referee_type').val(),
						franchisee_info = $('#franchisee_id').val(),
						confor_status	= $("#confor_status").val(),
						all_phone	 	= $("#all_phone").val(),
						refree_phone	= $("#refree_phone").val(),
						provinceCity 	= $("#provinceCity").val(),
						driver_type		= '{$driver_type}',
						work_province	= $("#province_id").val(),
						work_city		= $("#city_id").val(),
						sum_time 		= $("#sum_time").val();
					var str = "&type="+ type + "&refree_phone="+ refree_phone +"&all_phone="+ all_phone + "&driver_type="+ driver_type +"&start="
						+ start + "&end=" + end + "&auth_status=" + auth_status+ "&compliance_type="+ compliance_type + "&driver_phone=" + driver_phone + "&referee_type=" + referee_type + "&franchisee_info=" + franchisee_info + "&confor_status=" + confor_status+"&provinceCity="+provinceCity+"&sum_time="+sum_time+"&work_province="+work_province+"&work_city="+work_city;
					layer.confirm('请选择导出内容:', {
						btn: ['全部数据', '取消'] //可以无限个按钮
						, btn3: function (index, layero) {
							layer.close(index);
						}
					}, function (index, layero) {
						//按钮【按钮一】的回调
						location = "{:url('excel','all=1')}"+str ;
						layer.close(index);
					}, function (index) {
//                        location = "{:url('excel','all=2')}" + str+"&page="+_cur_page+"&limit="+_cur_limit;
//                        layer.close(index);
					});
				}
				, excelD: function () {
					var type 			= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
							start 			= $('#start').val(),									//时间 - 开始
							end 			= $('#end').val(),										//时间 - 结束
							auth_status 	= 1,								//认证状态
							compliance_type	= $("#compliance_type").val(),
							driver_phone	= $('#driver_phone').val(),
							referee_type	= $('#referee_type').val(),
							franchisee_info = $('#franchisee_id').val(),
							confor_status	= 1,
							all_phone	 	= $("#all_phone").val(),
							provinceCity 	= $("#provinceCity").val(),
							driver_type		= '{$driver_type}',
							work_province	= $("#province_id").val(),
							work_city		= $("#city_id").val(),
							sum_time = $("#sum_time").val();
					var str = "&type="+ type + "&all_phone="+ all_phone + "&driver_type="+ driver_type +"&start="
							+ start + "&end=" + end + "&auth_status=" + auth_status+ "&compliance_type="+ compliance_type + "&driver_phone=" + driver_phone + "&referee_type=" + referee_type + "&franchisee_info=" + franchisee_info + "&confor_status=" + confor_status+"&provinceCity="+provinceCity+"&sum_time="+sum_time+"&work_province="+work_province+"&work_city="+work_city;
					layer.confirm('请选择导出内容:', {
						btn: ['全部数据', '取消'] //可以无限个按钮
						, btn3: function (index, layero) {
							layer.close(index);
						}
					}, function (index, layero) {
						//按钮【按钮一】的回调
						location = "{:url('excelD','all=1')}"+str ;
						layer.close(index);
					}, function (index) {
//                        location = "{:url('excel','all=2')}" + str+"&page="+_cur_page+"&limit="+_cur_limit;
//                        layer.close(index);
					});
				}
				, excelC: function () {
					var type 			= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
							start 			= $('#start').val(),									//时间 - 开始
							end 			= $('#end').val(),										//时间 - 结束
							auth_status 	= 1,								//认证状态
							compliance_type	= $("#compliance_type").val(),
							driver_phone	= $('#driver_phone').val(),
							referee_type	= $('#referee_type').val(),
							franchisee_info = $('#franchisee_id').val(),
							confor_status	= 1,
							all_phone	 	= $("#all_phone").val(),
							provinceCity 	= $("#provinceCity").val(),
							driver_type		= '{$driver_type}',
							work_province	= $("#province_id").val(),
							work_city		= $("#city_id").val(),
							sum_time = $("#sum_time").val();
					var str = "&type="+ type + "&all_phone="+ all_phone + "&driver_type="+ driver_type +"&start="
							+ start + "&end=" + end + "&auth_status=" + auth_status+ "&compliance_type="+ compliance_type + "&driver_phone=" + driver_phone + "&referee_type=" + referee_type + "&franchisee_info=" + franchisee_info + "&confor_status=" + confor_status+"&provinceCity="+provinceCity+"&sum_time="+sum_time+"&work_province="+work_province+"&work_city="+work_city;
					layer.confirm('请选择导出内容:', {
						btn: ['全部数据', '取消'] //可以无限个按钮
						, btn3: function (index, layero) {
							layer.close(index);
						}
					}, function (index, layero) {
						//按钮【按钮一】的回调
						location = "{:url('excelC','all=1')}"+str ;
						layer.close(index);
					}, function (index) {
//                        location = "{:url('excel','all=2')}" + str+"&page="+_cur_page+"&limit="+_cur_limit;
//                        layer.close(index);
					});
				}
				, excelDC: function () {
					var type 			= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
							start 			= $('#start').val(),									//时间 - 开始
							end 			= $('#end').val(),										//时间 - 结束
							auth_status 	= 1,								//认证状态
							compliance_type	= $("#compliance_type").val(),
							driver_phone	= $('#driver_phone').val(),
							referee_type	= $('#referee_type').val(),
							franchisee_info = $('#franchisee_id').val(),
							confor_status	= 1,
							all_phone	 	= $("#all_phone").val(),
							provinceCity 	= $("#provinceCity").val(),
							driver_type		= '{$driver_type}',
							work_province	= $("#province_id").val(),
							work_city		= $("#city_id").val(),
							sum_time = $("#sum_time").val();
					var str = "&type="+ type + "&all_phone="+ all_phone + "&driver_type="+ driver_type +"&start="
							+ start + "&end=" + end + "&auth_status=" + auth_status+ "&compliance_type="+ compliance_type + "&driver_phone=" + driver_phone + "&referee_type=" + referee_type + "&franchisee_info=" + franchisee_info + "&confor_status=" + confor_status+"&provinceCity="+provinceCity+"&sum_time="+sum_time+"&work_province="+work_province+"&work_city="+work_city;
					layer.confirm('请选择导出内容:', {
						btn: ['全部数据', '取消'] //可以无限个按钮
						, btn3: function (index, layero) {
							layer.close(index);
						}
					}, function (index, layero) {
						//按钮【按钮一】的回调
						location = "{:url('excelDC','all=1')}"+str ;
						layer.close(index);
					}, function (index) {
//                        location = "{:url('excel','all=2')}" + str+"&page="+_cur_page+"&limit="+_cur_limit;
//                        layer.close(index);
					});
				}
				, excelyyD: function () {
					var type 			= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
						start 			= $('#start').val(),									//时间 - 开始
						end 			= $('#end').val(),										//时间 - 结束
						auth_status 	= 1,								//认证状态
						compliance_type	= $("#compliance_type").val(),
						driver_phone	= $('#driver_phone').val(),
						referee_type	= $('#referee_type').val(),
						franchisee_info = $('#franchisee_id').val(),
						confor_status	= 1,
						all_phone	 	= $("#all_phone").val(),
						provinceCity 	= $("#provinceCity").val(),
						driver_type		= '{$driver_type}',
						work_province	= $("#province_id").val(),
						work_city		= $("#city_id").val(),
						sum_time = $("#sum_time").val();
					var str = "&type="+ type + "&all_phone="+ all_phone + "&driver_type="+ driver_type +"&start="
						+ start + "&end=" + end + "&auth_status=" + auth_status+ "&compliance_type="+ compliance_type + "&driver_phone=" + driver_phone + "&referee_type=" + referee_type + "&franchisee_info=" + franchisee_info + "&confor_status=" + confor_status+"&provinceCity="+provinceCity+"&sum_time="+sum_time+"&work_province="+work_province+"&work_city="+work_city;
					layer.confirm('请选择导出内容:', {
						btn: ['全部数据', '取消'] //可以无限个按钮
						, btn3: function (index, layero) {
							layer.close(index);
						}
					}, function (index, layero) {
						//按钮【按钮一】的回调
						location = "{:url('excelyyD','all=1')}"+str ;
						layer.close(index);
					}, function (index) {
//                        location = "{:url('excel','all=2')}" + str+"&page="+_cur_page+"&limit="+_cur_limit;
//                        layer.close(index);
					});
				}
				, excelyyC: function () {
					var type 			= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
						start 			= $('#start').val(),									//时间 - 开始
						end 			= $('#end').val(),										//时间 - 结束
						auth_status 	= 1,								//认证状态
						compliance_type	= $("#compliance_type").val(),
						driver_phone	= $('#driver_phone').val(),
						referee_type	= $('#referee_type').val(),
						franchisee_info = $('#franchisee_id').val(),
						confor_status	= 1,
						all_phone	 	= $("#all_phone").val(),
						provinceCity 	= $("#provinceCity").val(),
						driver_type		= '{$driver_type}',
						work_province	= $("#province_id").val(),
						work_city		= $("#city_id").val(),
						sum_time = $("#sum_time").val();
					var str = "&type="+ type + "&all_phone="+ all_phone + "&driver_type="+ driver_type +"&start="
						+ start + "&end=" + end + "&auth_status=" + auth_status+ "&compliance_type="+ compliance_type + "&driver_phone=" + driver_phone + "&referee_type=" + referee_type + "&franchisee_info=" + franchisee_info + "&confor_status=" + confor_status+"&provinceCity="+provinceCity+"&sum_time="+sum_time+"&work_province="+work_province+"&work_city="+work_city;
					layer.confirm('请选择导出内容:', {
						btn: ['全部数据', '取消'] //可以无限个按钮
						, btn3: function (index, layero) {
							layer.close(index);
						}
					}, function (index, layero) {
						//按钮【按钮一】的回调
						location = "{:url('excelyyC','all=1')}"+str ;
						layer.close(index);
					}, function (index) {
//                        location = "{:url('excel','all=2')}" + str+"&page="+_cur_page+"&limit="+_cur_limit;
//                        layer.close(index);
					});
				}
			};
			$('.layui-btn').on('click', function () {
				var type = $(this).data('type');
				active[type] ? active[type].call(this) : '';
			});
			//监听工具条
			/*table.on('tool(driver)', function (obj) {
				var data = obj.data; //获得当前行数据
				var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
				var driver_id = data.driver_id;
				if (layEvent === 'del') {
					layer.confirm('确定删除吗?', function (index) {
						var url = "{:U('ajax_del')}";
						$.post(url, {'driver_id': driver_id}, function (data) {
							console.log(data);
						}, 'json');
						layer.close(index);
					});
				}
				else if (layEvent === 'driver_type') {
					layer.confirm('确定降级为快车司机吗?', function (index) {
						var url = "{:U('ajax_driver_type')}";
						var act = 'undriver_type';
						$.post(url, {'driver_id': driver_id,'act': act}, function (data) {
							console.log(data);
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}
				else if (layEvent === 'undriver_type') {
					layer.confirm('确定升级为城际司机吗?', function (index) {
						var url = "{:U('ajax_driver_type')}";
						$.post(url, {'driver_id': driver_id}, function (data) {
							console.log(data);
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}
				else if (layEvent === 'forbid') {
					layer.confirm('确定封禁吗?', function (index) {
						var url = "{:U('ajax_forbid')}";
						$.post(url, {'driver_id': driver_id}, function (data) {
							console.log(data);
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}
				else if (layEvent === 'unforbid') {
					layer.confirm('确定解除封禁吗?', function (index) {
						var url = "{:U('ajax_forbid')}";
						var act = 'unforbid';
						$.post(url, {'driver_id': driver_id,'act': act}, function (data) {
							console.log(data);
							switch (data.code) {
								case 1 :
									alert(data.msg);
									break;
								default :
									alert(data.msg);
							}
						}, 'json');
						layer.close(index);
						window.location.reload();
					});
				}
				else if (layEvent === 'detail') {
					layer.open({
						type: 2,
						title: '司机信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/driver/detail","driver_id=")}' + driver_id //iframe的url
					});
				}
				else if (layEvent === 'edit') {
					layer.open({
						type: 2,
						title: '司机信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/driver/edit","driver_id=")}' + driver_id //iframe的url
					});
				}
				//司机备案用于平台监控的
				else if (layEvent === 'beian') {
					layer.open({
						type: 2,
						title: '司机信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/system/sjba","driver_id=")}' + driver_id //iframe的url
					});
				}
				else if (layEvent === 'xinxi') {
					layer.open({
						type: 2,
						title: '司机信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/system/sjxx","driver_id=")}' + driver_id //iframe的url
					});
				}
				else if (layEvent === 'peixun') {
					layer.open({
						type: 2,
						title: '司机信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/system/sjpx","driver_id=")}' + driver_id //iframe的url
					});
				}

				else if (layEvent === 'avatar') {
					layer.open({
						type: 2,
						title: '司机头像审核',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/auth/avatar","driver_id=")}' + driver_id, //iframe的url
						cancel:function () {
							table_r(tableIns);
						}
					});
				}
				else if (layEvent === 'local') {
					layer.open({
						type: 2,
						title: [data.driver_name+'的当前位置','color:red;'],
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{$local}?auth_type='+data.at+"&driver_id=" + driver_id //iframe的url
					});
				}
				else if (layEvent === 'supplement') {
					layer.open({
						type: 2,
						title: '司机补录信息查看',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/driver/supplement","driver_id=")}' + driver_id //iframe的url
					});
				}
				else if (layEvent === 'flow') {
					layer.open({
						type: 2,
						title: [data.driver_name+'的流水','color:red;'],
						shadeClose: true,
						shade: 0.8,
						area: ['90%', '90%'],
						content: '/admin/Cash/flow?driver_id=' + driver_id //iframe的url
					});
				}
				else if (layEvent === 'driver_train') {
					layer.open({
						type: 2,
						title: [data.driver_name+'的培训信息','color:red;'],
						shadeClose: true,
						shade: 0.8,
						area: ['90%', '90%'],
						content: '/admin/System/sjpx?driver_id=' + driver_id //iframe的url
					});
				}
			});

			var $ = layui.jquery, active = {
				search: function () {
					var type = $('#type').val();
					var start = $('#start').val();
					var end = $('#end').val();
					var auth_type = $('#auth_type').val();
					var auth_avatar = $('#auth_avatar').val();
					var status = $('#auth_status').val();
					var driver_phone = $.trim($('#driver_phone').val());
					var reset = $('#reset');
					if (start || end || driver_phone || auth_type || status || auth_avatar) {
						reset.removeClass('layui-btn-disabled').addClass('layui-btn-normal').data('type', 'reset');
						tableIns.reload({
							url: '/admin/driver/searchIndex',
							where: {
								type: type,
								start: start,
								end: end,
								auth_type: auth_type,
								auth_avatar: auth_avatar,
								status: status,
								driver_phone: driver_phone
							} //设定异步数据接口的额外参数
						});
					} else {
						reset.removeClass('layui-btn-normal').addClass('layui-btn-disabled').data('type', '');
						alert('搜索项不能为空');
					}
				}
				, reset: function () {
					var reset = $('#reset');
					if (reset.data('type') !== '') {
						tableIns.reload({
							url: '{$url}',where:{}
						});
					}
					$('.layui-input').each(function () {                        $(this).val('');                    });                $('.layui-this').each(function () {$(this).removeClass('layui-this');});
					reset.removeClass('layui-btn-normal').addClass('layui-btn-disabled').data('type', '');
				}
				,auth_avatar:function () {
					tableIns.reload({
						url: '{$url}',where:{auth_avatar:2}
					});
				}
			};

			$('.layui-btn').on('click', function () {
				var type = $(this).data('type');
				active[type] ? active[type].call(this) : '';
			});*/
		});
		//选择省市切换
		function getProvinceList(){
			$("#city_id").empty();
			$("#city_id").append('<option value=>请选择城市</option>');
			var province_id = $("#province_id").val();
			$.ajax({
				url:'{:url("/admin/Franchisee/cityList")}',
				async:true,
				//dataType:'json',
				type:'post',
				data:{'province_id':province_id},
				success:function(res){
					$("#city_id").append(res);
				},
				error:function(e){
					layer.msg('请求错误');return false;
				}
			})
		};
	</script>
</block>
